import requests
import json


def call_api(instruction_content):
    # 设置API的URL
    url = "http://10.119.130.188:6007"  # 确保这是正确的URL

    # 设置请求的数据
    data = {
        "prompt": instruction_content,
        "history": []
    }

    # 发送POST请求
    response = requests.post(url, headers={"Content-Type": "application/json"}, json=data)

    # 检查响应状态码
    if response.status_code == 200:
        # 解析响应内容
        result = response.json()
        print("Response:", result["response"])
        return result["response"]
    else:
        print("Failed to retrieve data:", response.status_code)

    return "Error"
